Skip to content

lint: nodiscard results reads only declarations, and asio, beast, cobalt and trystero ask for it; a configured GCC 15 is probed - #22

Merged
pinhopro merged 5 commits into
mainfrom
nodiscard/v0.1
Nov 16, 2026
Merged

pinhopro merged 5 commits into
mainfrom
nodiscard/v0.1

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Summary

Three pieces of work that follow webcpp::crypto 0.1 and webcpp::hash increment 1, kept out of
their pull requests so those stay within their scope:

  • The nodiscard results rule reads only declarations. It read any
    system::result<...> name( as a function declaration, at any depth, so a local written with
    parentheses in a function's body was reported (hash brace-initialises three such locals only to
    dodge it). The rule is now scope-aware: it reads the declarations of namespaces and classes,
    aliases of result (also a using-declaration of it) and trailing return types, and skips a
    member's out-of-line definition and a friend declaration without a body, which its first
    declaration answers for.
  • asio, beast, cobalt and trystero ask for the rule, each in its own pull request whose head
    this branch records: asio's make_tls_client_context, beast's set_server_name, cobalt's
    shipped Wasm backend and native SSL wrapper (declared so by its generator), trystero's
    app::join. CODING-GUIDELINES.md lists the libraries that ask for it.
  • A configured GCC 15 is probed. The Jamroot compiles and runs
    tools/ci/actions/gcc/coroutine_probe.cpp, the CI's GCC 15 probe, with the GCC 15 a
    user-config.jam configures, once per compiler and run of b2; one that fails it, as GCC 15.2
    does (GCC PR121643, an internal compiler error on Cobalt's race), stops the build before it
    compiles anything, naming the compiler and GCC 15.3.

This branch is stacked on hash/v0.1 (webcpp::hash increment 1), which is stacked on crypto/v0.1:
its base is hash/v0.1 until that merges, then main. Merge order: #19, crypto/v0.1, hash/v0.1,
this one; then #17 rebases onto them. After this one merges, the four libraries' pull requests
are re-run against the new main and merged, so that main records commits of their main.

What changes

  • tools/lint/rules.py, tools/lint/lint_test.py, tools/lint/lint.sh: the rule's reading and its
    planted cases (ten findings, every spared form).
  • CODING-GUIDELINES.md: the rule's row names asio, beast, cobalt, crypto, hash and trystero; the
    cobalt chapter's PR121643 paragraph says what the local probe does.
  • Jamroot (gcc-probe, before the Boost check), tools/test/jamroot_test.py (a GCC 15 that fails
    the probe is refused, another GCC is not probed, a working one passes), AGENTS.md's
    prerequisites, doc/releases/0.1.0.adoc "Tools and build".
  • libs/asio, libs/beast, libs/cobalt, libs/trystero: the heads of their nodiscard-results pull
    requests (asio's on fix/diagnostic-directives, trystero's on crypto/secp256k1, beast's and
    cobalt's on their main).

Verification

Local, on this branch's tip, which holds crypto 0.1 and hash increment 1 too:

From scratch (b2 -a -j8, fresh build directories), the tests and examples of crypto, hash,
asio, beast, cobalt and trystero, 0 failed on every lane:

Lane Passed crypto hash asio beast cobalt trystero
native (Apple Clang 21) 489 152 153 78 28 26 52
wasip2 373 140 151 34 27 21 -
wasip3 417 133 151 84 28 21 -
Emscripten 430 92 118 113 28 20 59
gcc-15 (GCC 15.3, probe passing) 447 141 132 70 28 24 52
  • c-suites of crypto and hash: 107 passed on native, wasip2, wasip3 and Emscripten;
  • trystero's oracle lane passes; b2 -a doc: every library's doc-check and rendered check;
  • the lint lint: clean (2267 compile commands); all 61 tools/**/*_test.py pass;
  • MSVC 14.3 locally (Wine): 347 of 355 rows of crypto and hash pass, the 8 left being the known
    Wine artifact, summarize.sh: "green but for the known Wine failures"; 14.5 is left to the
    Windows CI, since both versions gave identical results on every earlier local run.

Known limits

  • The probe reads b2's gcc toolset flags through toolset.set-target-variables-aux, an
    undocumented rule; a b2 that renames it shows as a Jamroot error on gcc.
  • The probe runs the program it compiles, so a cross-compiling GCC 15 would be refused.
  • The rule matches alias names across a library, not by namespace; a namespace-scope variable
    written result<int> v(expr); is still read as a function (none exists).

🤖 Generated with Claude Code

R added 5 commits November 16, 2026 10:46
… classes, so a local written T name(arguments); in a function's body is no function; it reads an alias of result, a using-declaration of it and a trailing return type too, and not a member's out-of-line definition, which its declaration answers for

A { opens a scope of declarations only after a namespace's, a class's or an extern block's
head, the class's attributes and export macros let through; a function's body, a lambda, an
initializer and an enum do not, nor anything nested in them, and parentheses hide parameters.
Preprocessor lines are left out. Aliases are gathered across the library's headers. A finding
is reported at the function's name. lint_test plants the false positives and the gaps.
…ich takes no attribute (clang refuses one, GCC ignores it) and which the function's first declaration answers for; a hidden friend defined in its class is still read

The declaration's words are now read back from the result type itself, so a leading :: after
friend no longer hides the friend: cobalt's pipe.hpp declares friend ::boost::system::result<...>
pipe(...). lint_test plants a friend declaration, spared, and a hidden friend, reported.
… tools/ci/actions/gcc/coroutine_probe.cpp before anything builds, once per compiler and run of b2, and one that fails it, as GCC 15.2 does (GCC PR121643), stops the build naming the compiler and GCC 15.3
…sults branches, which ask for the nodiscard results rule

Each library's meta/lint.json asks for the rule, and every function of its include/ that returns boost::system::result is [[nodiscard]]: asio's make_tls_client_context, beast's set_server_name, cobalt's shipped Wasm backend and native SSL wrapper (declared so by upstream/sync.py), trystero's app::join. asio's branch stacks on fix/diagnostic-directives, trystero's on crypto/secp256k1, beast's and cobalt's on their main.
@pinhopro
pinhopro changed the base branch from hash/v0.1 to main November 16, 2026 14:10
@pinhopro
pinhopro merged commit d286118 into main Nov 16, 2026
1 check passed
@pinhopro
pinhopro deleted the nodiscard/v0.1 branch November 17, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant